//*******************批量发卡*****************************************************
//获取批量发卡的回调函数
function getCardBatchInfo(json) {
	if(json.statusCode==DWZ.statusCode.error){
		navTabAjaxDone(json)
	}else{
		var content = "";
		$(json).each(function(n, item) {
			var numPerPage = item.numPerPage;
			var currentPage = item.currentPage;
			var totalCount = item.totalCount;
			var pageCount = item.pageCount
			// alert(numPerPage+","+currentPage+","+totalCount);
			var list = item.list;
			if (list.length == 0) {
				content += "<tr><td colspan='7' align='center' >未查询到数据</td></tr>"
			} else {
				for (var i = 0; i < list.length; i++) {
					var value = list[i].applyBatchNo + "#"
							+ list[i].recordNum + "#"
							+ list[i].cardPCodeName + "#"
							+ list[i].collBranchNo +"#"
							+ list[i].workCorp;
		content += "<tr onmouseover='moveoverMouse(this)' onmouseout='moveoutMouse(this)' align='center'><td><input name='getCardBatch' onclick='saveByPagination(this)' value="
							+ value
							+ " type='radio'></td><td>"
							+ list[i].applyBatchNo
							+ "</td><td>"
							+ list[i].collBranchName
							+ "</td><td>"
							+ list[i].cardPCodeName
							+ "</td><td>"
							+ list[i].recordNum
							+ "</td><td>"
							+ getDate(list[i].applyDate)
							+ "</td><td>"
							+ list[i].workCorp + "</td></tr>"
				}

			}
			$("#getCardBatch").html(content);
			$("input[name='numPerPage']").val(numPerPage);
			$("input[name='pageNum']").val(currentPage);
			// $("input[name='pageCount']").val(pageCount);
			$("#totalCountByGetCardBatch").text(
					"条，共" + totalCount + "条");
			// var pagination="<a href='#'
			// onclick="+"previous($('#getCardBatchInfo'),getCardBatchInfo)
			// id='previous' >上一页 </a><a href='#'
			// onclick="+"next($('#getCardBatchInfo'),getCardBatchInfo)
			// id='next'>
			// 下一页</a><span>当前第"+currentPage+"页，共"+pageCount+"页</span>";
			// $("#paginationByGetCardBatch").html(pagination);
			$("#paginationByGetCardBatch").addClass("pagination")
					.attr("targetType", "navTab").attr(
							"totalCount", totalCount).attr(
							"numPerPage", numPerPage).attr(
							"pageNumShown", "10").attr(
							"currentPage", currentPage).attr("rel",
							"getCardBatch").attr("callback",
							"getCardBatchInfo");
			$("div.pagination").each(function() {
				var $this = $(this);
				$this.pagination({
					targetType : "navTab",
					rel : "getCardBatch",
					totalCount : totalCount,
					numPerPage : numPerPage,
					pageNumShown : 10,
					currentPage : currentPage,
					callback : getCardBatchInfo
				});
			});
			var $p = $("#ByGetCardBatch");
			initUI($p);
			for (var i = 0; i < list.length; i++) {
				for (var j = 0; j < array.length; j++) {
					if (list[i].applyBatchNo == array[j].split("#")[0]) {
						// alert("检查到相等了")
						// alert($("input[name='singletasked']:eq("+i+1+")").val())
						$(
								"input[name='singletasked']:eq("
										+ i + 1 + ")").attr(
								"checked", "checked")
						test($("input[name='singletasked']:eq(" + i
								+ 1 + ")"))

					}
				}
			}
		});
	}
};

// 验证checkBox
function validateChechBox10() {
	if ($("input[name='getCardBatch']:checked").length < 1) {
		alertMsg.warn("您未选择数据！")
		return false;
	}
	if ($("input[name='getCardBatch']:checked").length > 1) {
		alertMsg.warn("不能多于一条数据！")
		return false;
	}

}
// ***************************单笔发卡************************************************************
// 获取单笔发卡的回调函数
function getCardSingleInfo(json) {
	if(json.statusCode==DWZ.statusCode.error){
		navTabAjaxDone(json)
	}else{
		var content = "";
		$(json).each(function(n, item) {
			var numPerPage = item.numPerPage;
			var currentPage = item.currentPage;
			var totalCount = item.totalCount;
			var pageCount = item.pageCount
			var list = item.list;
			// alert(numPerPage+","+currentPage+","+totalCount);
			if (list.length == 0) {
				content += "<tr><td colspan='8' align='center' >未查询到数据</td></tr>"
			} else {
				for (var i = 0; i < list.length; i++) {// applyType
					var value = list[i].customerName + ","
							+ list[i].paperTypeName + ","
							+ list[i].paperNo + ","
							+ list[i].chcOriCitizenNo + ","
							+ list[i].applyType + ","
							+ list[i].applyTypeName + ","
							+ list[i].paperType + ","
							+ list[i].cardPName + ","
							+ list[i].branchNo;
					var chcOriCitizenNo = list[i].chcOriCitizenNo;
					if (chcOriCitizenNo == null) {
						chcOriCitizenNo = "无";
					}
					content += "<tr onmouseover='moveoverMouse(this)' onmouseout='moveoutMouse(this)' align='center'><td><input name='getCardSingle' onclick='test(this)' value="
							+ value
							+ " type='radio'></td><td>"
							+ list[i].customerName
							+ "</td><td>"
							+ list[i].paperTypeName
							+ "</td><td>"
							+ list[i].paperNo
							+ "</td><td>"
							+ chcOriCitizenNo
							+ "</td><td>"
							+ list[i].cardPName
							+ "</td><td>"
							+ list[i].branchName
							+ "</td><td>"
							+ list[i].claimStatusName
							+ "</td><td>"
							+ getDate(list[i].applyDate)
							+ "</td><td>"
							+ list[i].applyTypeName 
							+ "</td><td>"
							+ list[i].certNo + "</td></tr>"
				}
		
			}
			$("#getCardSingle").html(content);
			$("input[name='numPerPage']").val(numPerPage);
			$("input[name='pageNum']").val(currentPage);
			// $("input[name='pageCount']").val(pageCount);
			$("#totalCountBygetCardSingle").text(
					"条，共" + totalCount + "条");
			// var pagination="<a href='#'
			// onclick="+"previous($('#getCardSingleInfo'),getCardSingleInfo)
			// id='previous' >上一页 </a><a href='#'
			// onclick="+"next($('#getCardSingleInfo'),getCardSingleInfo)
			// id='next'>
			// 下一页</a><span>当前第"+currentPage+"页，共"+pageCount+"页</span>";
			// $("#paginationBygetCardSingle").html(pagination);
			$("#paginationByGetCardBatch").addClass("pagination")
					.attr("targetType", "navTab").attr(
							"totalCount", totalCount).attr(
							"numPerPage", numPerPage).attr(
							"pageNumShown", "10").attr(
							"currentPage", currentPage).attr("rel",
							"getCardSingle").attr("callback",
							"getCardSingleInfo");
			$("div.pagination").each(function() {
				var $this = $(this);
				$this.pagination({
					targetType : "navTab",
					rel : "getCardSingle",
					totalCount : totalCount,
					numPerPage : numPerPage,
					pageNumShown : 10,
					currentPage : currentPage,
					callback : getCardSingleInfo
				});
			});
			var $p = $("#ByGetCardSingle");
			initUI($p);
		});
	}
	
};

// 验证checkBox
function validateChechBox11() {
	if ($("input[name='getCardSingle']:checked").length < 1) {
		alertMsg.warn("您未选择数据！")
		return false;
	}
	if ($("input[name='getCardSingle']:checked").length > 1) {
		alertMsg.warn("不能多于一条数据！")
		return false;
	}
}

// *************************************售卡**********************************************

